package com.jh.user.pojo.enums;

import org.apache.commons.lang3.StringUtils;

public enum CardType {
    DEBIT("DEBIT", "借记卡"),
    CREDIT("CREDIT", "信用卡")
    ;
    private String value;
    private String desc;

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }
    CardType(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static <T extends String> CardType of (T n) {
        String val;
        val = n;
        if (StringUtils.isEmpty(val)) {
            return null;
        }
        for (CardType cardType : values()) {
            if (cardType.getValue().equals(val)) {
                return cardType;
            }
            if (cardType.getDesc().equals(val)) {
                return cardType;
            }
        }
        return null;
    }
}
